<template>
	<view  class="news">
		<news-item @itemClick="gotoDetail" :list="newsList"></news-item>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			newsList:[]	
			}
		},
		methods: {
			async getNews(){
			const res = await this.$myRequest({
				url:'/api/getnewslist'
			})
		this.newsList = res.data.message
		},
		goDetail(id){
			uni.navigateTo({
				url:'/pages/news-detail/news-detail?id='+id
			})	
		},
	},
		components:{"news-item":newsItem},
				onLoad(){
					this.getNews()
				}
			}
	
</script>

<style>
.news{
	
}
</style>
